"""
Copyright 2012 Wieser Dietmar, Margit Mutschlechner.

This file is part of Multimedia Social Networking Platform.

Multimedia Social Networking Platform is free software: 
you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Multimedia Social Networking Platform is distributed
in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Multimedia Social Networking Platform.  
If not, see <http://www.gnu.org/licenses/>.

"""

import hashlib

def hash(s):
    """Hashes a string.
    
    It hashes the string with the algorithm ripemd160
    and returns the result.
    
    Args:
        s: String to be hashed
        
    Returns:
        The hash value as String containing only hexadecimal digits.
    """
    
    h = hashlib.new('ripemd160', s)
    hash = h.hexdigest()
    return hash

def getHashRange():
    """Returns the range of the hash values (2^n different hash values -> returns n)."""
    
    return 160

